import java.util.Arrays;
import java.util.Comparator;

public class Text {
    public static void main(String[] args) {
        int[] arr = {10,9,8,7,6,5,4,3,2,1};
        int target = 1;
        System.out.println(retIndex(arr, target));
        
        
    }
    public static int retIndex (int[] arr,int target){
        int left = 0;
        int right = arr.length - 1;
        while (left < right){
    int mid = (left + right) >>> 1;
            if (arr[mid] < target){
                right = mid - 1;
            }else if( target < arr[mid]){
                left = mid + 1;
            }else {
            return  mid;
            }
        }
        return -1;
    }
}
